

using com.tc.zigbee.entity;
using com.tc.zigbee.entity.device;
using com.tc.zigbee.mt;
using com.tc.zigbee.zcl;
using com.tc.zigbee.mt.request;
using com.tc.gateway.device.ha;
namespace com.tc.zigbee.entity.device.ha
{
    public class ZigbeeOnoffOutput : ZigbeeDevice, OnoffOutput
    {

        public ZigbeeOnoffOutput(Endpoint endpoint, ZigbeeManager zm)
            : base(endpoint, zm) 
        {

        }

        override public void action()
        {
            toggle();

        }

        public void toggle()
        {

            byte[] zclcommand = ZclCommandCreator.toggle((byte)0);
            MtCommand mc = RequestFactory.MtAfDataRequest((byte)2,
                    endpoint.getParent().getNwkAddress(),
                //(short)1,
                    endpoint.getEndpointId(),
                    (byte)manager.getRemoteControl().getEndpointId(),
                    ZclConstants.ZCL_CLUSTER_ID_GEN_ON_OFF,
                    (byte)0,
                    (byte)0,
                    (byte)2,
                    (byte)zclcommand.Length,
                    zclcommand
                    );
            RequestQueue.offer(mc);
        }
    }
}